﻿// Decompiled with JetBrains decompiler
// Type: UnityEngine.Rendering.FilteringSettings
// Assembly: UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: E6AE6B5A-2752-4B07-9528-C8B77C62CE79
// Assembly location: C:\Users\windys\Unity\2021.3.39f1c1\Editor\Data\Managed\UnityEngine\UnityEngine.CoreModule.dll
// XML documentation location: C:\Users\windys\Unity\2021.3.39f1c1\Editor\Data\Managed\UnityEngine\UnityEngine.CoreModule.xml

using System;
using UnityEngine.Internal;

#nullable disable
namespace UnityEngine.Rendering
{
  /// <summary>
  ///   <para>A struct that represents filtering settings for ScriptableRenderContext.DrawRenderers.</para>
  /// </summary>
  public struct FilteringSettings : IEquatable<FilteringSettings>
  {
    private RenderQueueRange m_RenderQueueRange;
    private int m_LayerMask;
    private uint m_RenderingLayerMask;
    private int m_ExcludeMotionVectorObjects;
    private SortingLayerRange m_SortingLayerRange;

    /// <summary>
    ///   <para>Creates a FilteringSettings struct that contains default values for all properties. With these default values, Unity does not perform any filtering.</para>
    /// </summary>
    public static FilteringSettings defaultValue
    {
      get => new FilteringSettings(new RenderQueueRange?(RenderQueueRange.all));
    }

    public FilteringSettings(
      [DefaultValue("RenderQueueRange.all")] RenderQueueRange? renderQueueRange = null,
      int layerMask = -1,
      uint renderingLayerMask = 4294967295,
      int excludeMotionVectorObjects = 0)
      : this()
    {
      this.m_RenderQueueRange = renderQueueRange ?? RenderQueueRange.all;
      this.m_LayerMask = layerMask;
      this.m_RenderingLayerMask = renderingLayerMask;
      this.m_ExcludeMotionVectorObjects = excludeMotionVectorObjects;
      this.m_SortingLayerRange = SortingLayerRange.all;
    }

    /// <summary>
    ///   <para>Unity renders objects whose Material.renderQueue value is within range specified by this Rendering.RenderQueueRange.</para>
    /// </summary>
    public RenderQueueRange renderQueueRange
    {
      get => this.m_RenderQueueRange;
      set => this.m_RenderQueueRange = value;
    }

    /// <summary>
    ///   <para>Unity renders objects whose GameObject.layer value is enabled in this bit mask.</para>
    /// </summary>
    public int layerMask
    {
      get => this.m_LayerMask;
      set => this.m_LayerMask = value;
    }

    /// <summary>
    ///   <para>Unity renders objects whose Renderer.renderingLayerMask value is enabled in this bit mask.</para>
    /// </summary>
    public uint renderingLayerMask
    {
      get => this.m_RenderingLayerMask;
      set => this.m_RenderingLayerMask = value;
    }

    /// <summary>
    ///         <para>Determines if Unity excludes GameObjects that are in motion from rendering. This refers to GameObjects that have an active Motion Vector pass assigned to their Material or have set the Motion Vector mode to per object motion (Menu: Mesh Renderer &gt; Additional Settings &gt; Motion Vectors &gt; Per Object Motion).
    /// For Unity to exclude a GameObject from rendering, the GameObject must have moved since the last frame. To exclude a GameObject manually, enable a pass.</para>
    ///       </summary>
    public bool excludeMotionVectorObjects
    {
      get => this.m_ExcludeMotionVectorObjects != 0;
      set => this.m_ExcludeMotionVectorObjects = value ? 1 : 0;
    }

    /// <summary>
    ///   <para>Unity renders objects whose SortingLayer.value value is within range specified by this Rendering.SortingLayerRange.</para>
    /// </summary>
    public SortingLayerRange sortingLayerRange
    {
      get => this.m_SortingLayerRange;
      set => this.m_SortingLayerRange = value;
    }

    public bool Equals(FilteringSettings other)
    {
      return this.m_RenderQueueRange.Equals(other.m_RenderQueueRange) && this.m_LayerMask == other.m_LayerMask && (int) this.m_RenderingLayerMask == (int) other.m_RenderingLayerMask && this.m_ExcludeMotionVectorObjects == other.m_ExcludeMotionVectorObjects;
    }

    public override bool Equals(object obj)
    {
      return obj != null && obj is FilteringSettings other && this.Equals(other);
    }

    public override int GetHashCode()
    {
      return ((this.m_RenderQueueRange.GetHashCode() * 397 ^ this.m_LayerMask) * 397 ^ (int) this.m_RenderingLayerMask) * 397 ^ this.m_ExcludeMotionVectorObjects;
    }

    public static bool operator ==(FilteringSettings left, FilteringSettings right)
    {
      return left.Equals(right);
    }

    public static bool operator !=(FilteringSettings left, FilteringSettings right)
    {
      return !left.Equals(right);
    }
  }
}
